home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1ES2VVE (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  863 b   |  45 lines

  1. package sun.misc;
  2.  
  3. public abstract class Ref {
  4.    static long lruclock;
  5.    private Object thing;
  6.    private long priority;
  7.  
  8.    public Ref() {
  9.       this.priority = ++lruclock;
  10.    }
  11.  
  12.    public Object check() {
  13.       return this.thing;
  14.    }
  15.  
  16.    public void flush() {
  17.       this.thing = null;
  18.    }
  19.  
  20.    public Object get() {
  21.       Object p = this.thing;
  22.       if (p == null) {
  23.          synchronized(this){}
  24.  
  25.          try {
  26.             if ((p = this.thing) == null) {
  27.                p = this.reconstitute();
  28.                this.thing = p;
  29.             }
  30.          } catch (Throwable var4) {
  31.             throw var4;
  32.          }
  33.       }
  34.  
  35.       this.priority = ++lruclock;
  36.       return p;
  37.    }
  38.  
  39.    public abstract Object reconstitute();
  40.  
  41.    public void setThing(Object thing) {
  42.       this.thing = thing;
  43.    }
  44. }
  45.